package com.zc.microservice.user.core.app.controller;

import com.zc.commons.http.entity.Response;
import com.zc.microservice.user.core.app.service.UserBaseService;
import com.zc.microservice.user.core.domain.pojo.LoginUser;
import com.zc.microservice.user.core.domain.pojo.RegistUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 基础服务controller
 *
 * @author zcj
 * @version 1.0.0
 * @date 2022/1/13 17:12
 */
@RestController
@RequestMapping(value = "/")
public class BaseServiceController {

    @Autowired
    private UserBaseService userBaseService;

    @PostMapping("/login")
    public Response<String> login(@RequestBody LoginUser loginUser) {
        return Response.ok(userBaseService.doLogin(loginUser));
    }

    @PostMapping("/regist")
    public Response<String> regist(@RequestBody RegistUser registUser) {
        userBaseService.doRegist(registUser);
        return Response.ok();
    }

}
